class Solution
{
public:
    int maxScore(vector<int> &nums)
    {
        sort(nums.rbegin(), nums.rend());
        long long prefixSum = 0;
        int score = 0;
        for (int num : nums)
        {
            prefixSum += num;
            if (prefixSum > 0)
            {
                ++score;
            }
            else
            {
                break;
            }
        }
        return score;
    }
};